package io.renren.utils.util.exception;

import io.renren.utils.util.CommonErrorUtil;


@SuppressWarnings("serial")
public class XMTException extends java.lang.Exception {

//	protected java.lang.Exception m_causeExcption = new java.lang.Exception();
//
//	@SuppressWarnings({ "rawtypes" })
//	public Vector m_causePath = new Vector();

	protected int m_causeCode = 0;

	public XMTException() {
		super();
		// this.m_causePath.add(this);
	}

	public XMTException(java.lang.Throwable cause) {
		super(cause);
//		this.m_causeExcption = new Exception(cause);
//		this.inheritCause(cause);
	}

	public XMTException(java.lang.Throwable cause, int code) {

		super(cause);
//		this.m_causeExcption = new Exception(cause);
		this.m_causeCode = code;
//		this.inheritCause(cause);
	}

	public XMTException(String msg, int code) {
		super(msg);
//		this.m_causeExcption = new Exception(msg);
		this.m_causeCode = code;
	}

	public XMTException(String msg) {
		super(msg);
//		this.m_causeExcption = new Exception(msg);
	}

	public XMTException(String msg, java.lang.Throwable cause) {
		super(msg, cause);
//		this.m_causeExcption = new Exception(msg, cause);
//		this.inheritCause(cause);
	}

	public XMTException(String msg, java.lang.Throwable cause, int code) {
		super(msg, cause);
//		this.m_causeExcption = new Exception(msg, cause);
		this.m_causeCode = code;
//		this.inheritCause(cause);
	}

	public String getLocalizedMessage() {
		return CommonErrorUtil.getErrorLocalizedMessage(this);
	}

//	public void exportInfo() {
//
//		System.out.println(this.getLocalizedMessage());
//
//		for (int cnt = 0; cnt < this.m_causePath.size(); cnt++) {
//
//			XMTException p_obj = (XMTException) this.m_causePath.get(cnt);
//
//			System.out.println(p_obj.getLocalizedMessage());
//
//		}
//
//	}

//	@SuppressWarnings("unchecked")
//	private void inheritCause(java.lang.Throwable cause) {
//
//		if ((cause instanceof XMTException) == false) {
//
//			return;
//		}
//		XMTException x_cause = (XMTException) cause;
//
//		this.m_causePath.add(cause);// add parenet cause
//
//		this.m_causePath.addAll(x_cause.m_causePath);// add parenet's parent // cause;
//
//		this.m_causeCode = x_cause.m_causeCode;
//
//	}

	public int getCauseCode() {
		return this.m_causeCode;
	}

}
